$('.address_box').on('click','.edit',function(e){
    e.stopPropagation();
    $('.dialog').css('display','flex')
})

$('.dialog').on('click','.sure',function(){
    $('.dialog').hide()
})
$('.dialog').on('click','.mask,.cancel',function(){
    $('.dialog').hide()
})

$('.address_box').on('click','.item',function(){
        
     $(this).addClass('item_act').siblings('.item').removeClass('item_act')
    $(this).find('.radio_icon').addClass('radio_have').parents('.item').siblings('.item').find('.radio_icon').removeClass('radio_have') 
})

$('.textarea_box textarea').on('input',function(e){
    $('.input_num').text($(this).val().length)
})

$('.address_more').on('click',function(){

    let addressItem=`  <div class="item">
                    <div class="item_pc">
                        <div class="left">
                            <img src="../img/member/address_have_icon.png" alt=""  class="addre_icon">
                            <span class="main_color">寄送至</span>
                            <i class="radio_icon"></i>
                            <span class="desc">北京市 昌平区 霍营街道 龙锦苑东二区14号楼2单元602</span>
                            <span class="name">（周方方 收）</span>
                            <span class="phone">18596385211</span>
                            <span class="tab">默认地址</span>
                        </div>
                        <span class="edit">修改地址</span>
                    </div>
                    <div class="item_mobile">
                        <div  class="m_head">
                            <div class="mh_left">
                                <p><span class="name">周方方</span><span class="phone">18596385211</span> </p>
                                <p><span class="desc">北京市 昌平区 霍营街道 龙锦苑东二区14号楼2单元602</span></p>
                            </div>
                            <i class="edit">修改</i>
                        </div>
                        <div class="m_bottom">
                             <i class="radio_icon"></i> 默认收货地址
                        </div>
                    </div>
                </div>
    `
   if($(this).hasClass('open')){
        $('.address_box').empty()
        let addClassList=''
        for(let i=0;i<2;i++){
            addClassList+=addressItem
        }
        $('.address_box').append(addClassList)
        $('.address_box .item').eq(0).addClass('item_act').find('.radio_icon').addClass('radio_have')
        $(this).removeClass('open').find('span').text('展示全部内容')
        $(this).find('.iconfont').css('transform','rotate(0)')
   }else{
        $('.address_box').empty()
        let addClassList=''
        for(let i=0;i<6;i++){
            addClassList+=addressItem
        }
        $('.address_box').append(addClassList)
        $('.address_box .item').eq(0).addClass('item_act').find('.radio_icon').addClass('radio_have')
        $(this).addClass('open').find('span').text('隐藏部分地址')
         $(this).find('.iconfont').css('transform','rotate(180deg)')
    }
   
    
})